// 用户列表，用户详情

<template>
  <div style="width:100%;height:100%;background-color:#3b4551;text-align: center;">
      <div style="width:50%;margin:auto;min-width:950px">
        <el-page-header id="page" @back='()=>{$router.push("/admin/index")}' content="用户列表" style="color:#ffffff;padding-top:10px"></el-page-header>

        <el-table
          id="list"
          :data="log_data"
          style="width: 100%;margin-top:50px;"
          @row-click='toUser'
          >
          <el-table-column
            label="Id"
            width="100">
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{ scope.row.id }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="账号"
            width="100">
            <template slot-scope="scope">
                <span style="margin-left: 10px">{{ scope.row.account }}</span>
            </template>
          </el-table-column>

          <el-table-column
            label="邮箱"
            width="200">
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{ scope.row.email }}</span>
            </template>
          </el-table-column>

          <el-table-column
            label="站点数"
            width="100">
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{ scope.row.count }}</span>
            </template>
          </el-table-column>

          <el-table-column
            label="最后登录时间"
            width="200">
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{ scope.row.login_time }}</span>
            </template>
          </el-table-column>

          <el-table-column
            label="注册时间"
            width="200">
            <template slot-scope="scope">
              <span style="margin-left: 10px">{{ scope.row.create_time }}</span>
            </template>
          </el-table-column>

        </el-table>
      </div>
  </div>
</template>


<script>
export default {
  data(){
    return{
      mark:'',
      log_data:[],
    }
  },
  methods:{
    toUser(row){
      //点击进入用户详情
      this.$router.push('/admin/user_data/list/'+row.id);
    },
    //获取今天的日志
    getUser(){
      this.$axios.post(this.$API.USERLIST).then(res=>{
        console.log(res);
        if(res.code==200 && res.data){
          this.log_data = res.data;
        }else{
          alert('获取失败');
        }
      });
    }
  },
  created(){
    //获取资源
    this.getUser();
  }
}
</script>


<style scoped>
  #page >>> div.el-page-header__content{
    color:#ffffff !important;
  }

  span{
    margin-left: 0 !important;
  }

  #list{
    border-radius: 5px;
  }
</style>
